#ifndef __UI_TOUCH_H
#define __UI_TOUCH_H

#include <stdint.h>
#include "dataproc.h"
#include "mytype.h"

#ifdef __cplusplus
extern "C"
{
#endif

    struct ui_touch_obj_str
    {
        struct
        {
            ii16 x, y;
        } site;
        struct
        {
            ii16 x, y;
        } size;
        uu32 user_data;
        void (*press_callback)(struct ui_touch_obj_str *info);
        void (*press_edge_callback)(struct ui_touch_obj_str *info);
        void (*release_callback)(struct ui_touch_obj_str *info);
        struct ui_touch_obj_str *next;
    };

    typedef struct ui_touch_obj_str ui_touch_obj_type;
        
    char ui_touch_point_check(ui_touch_obj_type *list, uu16 list_len, ii16 x, ii16 y);

    void ui_touch_rang_set(ii16 x, ii16 y, ii16 wide, ii16 high);
    
    typedef enum
    {
        UI_TEXT_MODE_NUM = 0,
        UI_TEXT_MODE_TXT,
        UI_TEXT_MODE_TIM2,
        UI_TEXT_MODE_TIM3,
        UI_TEXT_MODE_TXT_CN, 
    } ui_text_mode_type;

    struct ui_text_in_pinyin_str 
    {
        const gb2312_pinyin_tab_type *tab; 
        uu8 words_length;                  
        uu8 ch_cnt;                        
        uu8 st_full_pinyin;                
        uu8 words_amount;                  
        uu8 next_words_site_sub;           
        uu8 head_words_site_sub;           
        uu16 yin_site_start;               
        uu16 yin_site_end;                 
        uu16 next_words_site_yin;          
        uu16 head_words_site_yin;          
        char yin[10];                      
        char words[20];                    
    };

    struct ui_text_in_obj_str
    {
        ii16 index_next;                  
        ii16 len_total;                   
        ii16 len_remain;                  
        uu8 b_rang_en;                    
        uu8 in_pn;                        
        ui_text_mode_type mode;           
        ii32 num;                         
        ii32 min;                         
        ii32 max;                         
        char *buff;                       
        struct ui_text_in_pinyin_str *cn; 
    };
    typedef struct ui_text_in_obj_str ui_text_in_obj_type;

    void ui_cn_text_input_mount(                                               
        ui_text_in_obj_type *obj,                                              
        struct ui_text_in_pinyin_str *cn,                                      
        const gb2312_pinyin_tab_type *dict,                                    
        ii16 sel_len);                                                         
    void ui_text_input_reset(ui_text_in_obj_type *obj, uu8 *buff, ii16 len);   
    void ui_text_input_mode(ui_text_in_obj_type *obj, ui_text_mode_type mode); 
    uu8 ui_text_nocn_input_add(ui_text_in_obj_type *obj, uu8 ch);              
    void ui_text_nocn_input_del(ui_text_in_obj_type *obj);                     
    uu8 ui_text_input_add(ui_text_in_obj_type *obj, uu8 ch);                   
    void ui_text_input_del(ui_text_in_obj_type *obj);                          

    void ui_cn_text_words_next(ui_text_in_obj_type *obj);             
    void ui_cn_text_words_prev(ui_text_in_obj_type *obj);             
    void ui_cn_text_words_select(ui_text_in_obj_type *obj, uu08 sel); 

    void ui_num_text_input_rang(ui_text_in_obj_type *obj, uu8 en, ii32 min, ii32 max);
    void ui_num_text_input_inpn_set(ui_text_in_obj_type *obj, uu8 in, uu8 pn);

#ifdef __cplusplus
}
#endif

#endif 
